Presentation: Tweet"New Concurrency Utilities in Java 8"
There are a couple of new concurrency utilities in Java 8. The most relevant one is CompletableFuture. The regular Future is used for retrieval of a result that is produced by a task (typically a task that is executed in a thread pool). For this purpose the regular Future supports waiting for the result and retrieving it once it has been produced. After retrieval the result is processed synchronously. The new CompletableFuture, in contrast, supports asynchronous result processing: we need not wait until the result of a task has been produced, instead we can upfront specify an action (the result processing) that will later be executed automatically when the result appears. In addition, Java 8 comes with a couple of minor extensions related to concurrency: StampedLock (a ReadWriteLock with optimistic Read), LongAdder / LongAccumulator (as an alternative to AtomicLong), new operations in ConcurrentHashMap (e.g.. computeIfAbsent, forEach, reduce, search), the Common Pool (a singleton ForkJoinPool) and the @Contended annotation (to prevent False Sharing).
Audience: Java developers with sound knowledge in Java concurrency who want to keep their knowledge up to date
Level: medium